<html><head><title>WriteCGIData</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">WriteCGIData()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>WriteCGIData</b></font>(*Buffer, Size)</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Writes binary data to the CGI output. When sending binary data, the 'content-type' header should be set to 
'application/octet-stream'. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>*Buffer</i></td>
<td width="90%"> 
The memory buffer to write. 

</td></tr>
<tr><td><i>Size</i></td>
<td> 
The size (in bytes) to write. 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns non-zero if the data has been successfully written to the CGI output. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <b><font color="#3A3966">Not</font></b> <font color="#3A3966">InitCGI</font>() <b><font color="#3A3966">Or</font></b> <b><font color="#3A3966">Not</font></b> <font color="#3A3966">ReadCGI</font>()
    <b><font color="#3A3966">End</font></b>
  <b><font color="#3A3966">EndIf</font></b>
  
<font color="#3A3966">  WriteCGIHeader</font>(<font color="#924B72">#PB_CGI_HeaderContentType</font>, &quot;application/octet-stream&quot;)
<font color="#3A3966">  WriteCGIHeader</font>(<font color="#924B72">#PB_CGI_HeaderContentDisposition</font>, &quot;attachment; filename=image.png&quot;, <font color="#924B72">#PB_CGI_LastHeader</font>)
  
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">ReadFile</font>(0, <font color="#924B72">#PB_Compiler_Home</font> + &quot;examples/sources/data/world.png&quot;)
    Size =<font color="#3A3966"> Lof</font>(0)
    *Buffer =<font color="#3A3966"> AllocateMemory</font>(Size)
<font color="#3A3966">    ReadData</font>(0, *Buffer, Size) <font color="#3A3966">; Read the whole file into the new allocated buffer</font>
    
<font color="#3A3966">    WriteCGIData</font>(*Buffer, Size) <font color="#3A3966">; Write the whole buffer to the CGI output</font>
    
<font color="#3A3966">    CloseFile</font>(0)
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="initcgi.html">InitCGI()</a>, <a href="writecgiheader.html">WriteCGIHeader()</a>, <a href="writecgifile.html">WriteCGIFile()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=waitfastcgirequest.html>WaitFastCGIRequest()</a> - <a href="index.html">CGI Index</a> - <a href="writecgifile.html">WriteCGIFile()</a> -><br><br>

</body></html>